package com.example.demo;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.ThreadContext;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.mail.Session;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;

@SpringBootApplication
@RestController
public class DemoApplication {

    public static void main(String[] args) {

        SpringApplication.run(DemoApplication.class, args);

    }
    private static final Logger LOG = LogManager.getLogger(DemoApplication.class);

    @Autowired
    private SendEmail sendEmail;
    @GetMapping("/test")
    public String test() {
//        MailVo mailVo = new MailVo();
//        mailVo.setTo("1123940789@qq.com");
//        mailVo.setSubject("hello");
//        mailVo.setText("I am fine");
//        sendEmail.sendMail(mailVo);
//        sendEmail.contextLoads();
//        ThreadContext.put("username","19980202");
//        MDC.put("username","5433223");
        LOG.debug("debug 级别日志 ...");
        LOG.info("info 级别日志 ...");
        LOG.warn("warn 级别日志 ...");
        LOG.error("error 级别日志 ...");
        LOG.fatal("fatal 级别日志 ...");
        return "Hello Log4j2 !";
    }




}
